package com.sjq.model.common;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.persistence.Transient;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import java.io.Serializable;

/**
 * 分页排序通用Dto
 * @author dolyw.com
 * @date 2021/12/10 10:10
 */
@Data
@Accessors(chain = true)
public class BaseDto implements Serializable {

    private static final long serialVersionUID = 1L;

    /** 当前页数 */
    @ApiModelProperty("当前页数，默认第1页")
    @Transient
    @Min(value = 1, message = "当前页数不能小于1")
    private Integer pageNum=1;

    /** 每页条数 */
    @ApiModelProperty("每页条数，默认每页10条")
    @Transient
    @Min(value = 1, message = "每页条数不能小于1")
    @Max(value = 50, message = "每页条数不能大于50")
    private Integer pageSize=10;

    /** 排序的列名 */
    @ApiModelProperty("排序的列名,默认’id‘")
    @Transient
    private String sidx="id";

    /** 排序规则(DESC或者ASC) */
    @ApiModelProperty("排序规则(DESC或者ASC)，默认’DESC‘")
    @Transient
    private String sord="DESC";

}
